<template>
<div class="home-mobile-box">
  <div>
    <BoxHeader title="手机" :link="{ href: 'search', text: '查看全部' }"></BoxHeader>
    <div class="box-bd">
      <div class="row">
        <!-- <div class="mobile-left">
          <ul class="mobile-left-list">
            <ProductBox type="BackgroundImg" imgSrc="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/a5d3a59f7b53c23feab77434aa1f383b.jpg?thumb=1&w=468&h=1228&f=webp&q=90" height="614px"></ProductBox>
          </ul>
        </div> -->
        <div class="mobile-right">
          <div class="brick-list">
              <ProductBox v-for="good in list" :key="good.id" :title="good.title" :desc="good.desc" :price="Number(good.min_price)" imgSrc="https://cdn.cnbj1.fds.api.mi-img.com/nr-pub/202305291422_e96776c7e1e35cebb454457c3344d3cd.png?thumb=1&w=400&h=400&f=webp&q=90" @click="$router.push({ path: '/detail', query: {good_id:good.id} })"/>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</template>

<script>
import BoxHeader from '@/components/BoxHeader'
import ProductBox from '@/components/ProductBox'
import { getGoodsList } from '@/api/goods'

export default {
  components: {
    BoxHeader,
    ProductBox
  },
  data () {
    return {
      list: null
    }
  },
  methods: {
    async GoodsList (category, limit) {
      try {
        const { data } = await getGoodsList(category, limit)
        this.list = data.data.list
      } catch (error) {
        return console.log(error)
      }
    }

  },
  created () {
    this.GoodsList(5, 8)
  }
}
</script>

<style scoped>
.home-main .home-mobile-box .box-hd {
  position: relative;
  height: 58px;
}

.home-mobile-box .box-hd .title {
  font-size: 22px;
  font-weight: 200;
  line-height: 58px;
  color: #333;
}

.home-mobile-box .box-hd .more {
  position: absolute;
  top: 0;
  right: 0;
}

.home-mobile-box .box-hd .more .more-link {
  line-height: 58px;
  color: #424242;
  font-size: 16px;
  transition: all .4s;
}

.home-mobile-box .more .more-link .iconfont-arrow-right-big {
  width: 12px;
  height: 12px;
  color: #fff;
  padding: 4px;
  margin-left: 8px;
  background: #b0b0b0;
  line-height: 12px;
  border-radius: 50%;
  transition: all .4s;
  font-size: 12px;
  vertical-align: 1px;
}

.home-mobile-box .more .more-link:hover {
  color: #ff6700;
}

.home-mobile-box .more .more-link:hover .iconfont-arrow-right-big {
  background-color: #ff6700;
}

.home-mobile-box .box-bd .row {
  display: flex;
}

.home-mobile-box .mobile-left-list {
  margin: 0 0 -14px -14px;
}

.mobile-left-list .brick-item-l {
  height: 614px;
}

.home-mobile-box .mobile-left-list .brick-item {
  width: 234px;
  margin-left: 14px;
  margin-bottom: 14px;
  background: #fff;
}

.brick-item-l img {
  height: 614px;
}

.mobile-left-list a {
  display: block;
  width: 100%;
  height: 100%;
}

.mobile-right .brick-list {
  margin: 0 0 -14px -14px;
  display: flex;
  flex-wrap: wrap;
}

.brick-item-m {
  height: 246px;
  padding: 34px 0 20px;
}

.brick-item-m-2 {
  height: 260px;
  padding: 20px 0;
}

.brick-item {
  width: 234px;
  margin-left: 14px;
  margin-bottom: 14px;
  background: #fff;
  transition: all .2s linear;
}

.brick-item .figure-img img {
  width: 160px;
  height: 160px;
}

.brick-item-m .figure-img {
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
}

.brick-item-m-2 .figure-img,
.brick-item-m-2 .figure-img img {
  width: 160px;
  height: 160px;
}

.brick-item-m .desc,
.brick-item-m .title {
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.brick-item-m .title {
  margin: 0 10px;
  font-size: 14px;
  font-weight: 400;
  color: #333;
}

.brick-item-m-2 .title {
  margin: 0 10px 2px;
}

.brick-item-m .desc {
  margin: 0 10px 10px;
  height: 18px;
  font-size: 12px;
  color: #b0b0b0;
}

.brick-item-m .price {
  margin: 0 10px 10px;
  text-align: center;
  color: #ff6700;
  font-size: 14px;
}

.brick-item-m-2 .price {
  margin: 0 10px 14px;
}

.brick-item:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, .1);
  transform: translate3d(0, -2px, 0);
}
</style>
